package com.right.health.app.ui.me.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.magic.basic.adapter.BaseAbsAdapter;
import com.right.health.app.R;
import com.right.health.app.bean.ServicePackResponse;

/**
 * @author weming
 * @Date 2021/4/21
 * @description 服务包适配器
 */
public class ServicePackAdapter extends BaseAbsAdapter<ServicePackResponse.ServicesBean> {

    public ServicePackAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_service_pack, null);
            viewHolder = new ViewHolder();
            viewHolder.mContentLy = convertView.findViewById(R.id.ly_content);
            viewHolder.mTitleTv = convertView.findViewById(R.id.tv_title);
            viewHolder.mContentTv = convertView.findViewById(R.id.tv_content);
            viewHolder.mIconIv = convertView.findViewById(R.id.iv_img);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        ServicePackResponse.ServicesBean bean = getDataSource().get(position);
        viewHolder.mTitleTv.setText(bean.getPkname());
        viewHolder.mContentTv.setText(bean.getPkdesc());
//        Glide.with(App.getInstance()).load(HttpConstants.BASE_URL + bean.getPkicon()).into(viewHolder.mIconIv);
        return convertView;
    }

    static class ViewHolder {
        private TextView mTitleTv, mContentTv;
        private ImageView mIconIv;
        private ViewGroup mContentLy;
    }
}
